#!/usr/bin/python3
import sys

try:
    t = int(input())
    if t < 1 or t > 20:
        sys.exit(0)
    for x in range(t):
        a, b = list(map(int, input().split()))
        container = []
        result = str(int(a / b)) + '.'
        isFind = False
        for i in range(9):
            temp = a * 10 % b
            if temp == 0:
                break
            else:
                if temp in container:
                    isFind = True
                    break
                else:
                    result += str(int(a * 10 / b))
                    a = temp
                    container.append(temp)
        if isFind:
            print('Case #{}: {}'.format(x + 1, result))
        else:
            print('Case #{}: {}'.format(x + 1, 'heiheihei'))
except ValueError:
    pass
except EOFError:
    pass
except MemoryError:
    pass
